/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: GodK
 * Date: 2024-07-20
 * Time: 21:10
 */
public class Main {
    public static Object locker1 = new Object();
    public static Object locker2 = new Object();
    public static Object locker3 = new Object();

    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            System.out.println("A");
            synchronized (locker1){
                locker1.notify();
            }
        });
        Thread t2 = new Thread(()->{
            synchronized (locker1) {
                try {
                    locker1.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("B");
            }
            synchronized (locker2) {
                locker2.notify();
            }
        });
        Thread t3 = new Thread(()->{
            synchronized (locker2) {
                try {
                    locker2.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            synchronized (locker3){
                System.out.println("C");
            }
        });
        t1.start();
        t2.start();
        t3.start();
    }
}
